<extend name="Public:base" />

<block name="content">


    <div>
        <div class="container">
            <div class="row">

                <div id="content" class="col-sm-9">
                    <fieldset>
                            <input name="address_id" type="hidden" value="{$address.address_id|default=''}" />
                        <div class="form-group required clearfix">
                            <label class="col-sm-2 control-label">收货人</label>
                            <div class="col-sm-10">
                                <input type="text"  value="{$address.name|default=''}" name="name" style="width: 309.818182px;">
                            </div>
                        </div>
                        <div class="form-group required clearfix">
                            <label class="col-sm-2 control-label">联系电话</label>
                            <div class="col-sm-10">
                                <input type="text"  value="{$address.telephone|default=''}" name="telephone" style="width: 309.818182px;">
                            </div>
                        </div>
                        <div class="form-group required clearfix">
                            <label class="col-sm-2 control-label">收货地址</label>
                            <div class="col-sm-10">
                                <input type="text"  value="{$address.address|default=''}" name="address" style="width: 309.818182px;">
                            </div>
                        </div>
                    </fieldset>
                    <div class="buttons clearfix">
                        <div class="left" style="margin-left:15px;">
                            <button class="btn btn-primary " id="sub">提交</button>
                        </div>
                    </div>

                </div>

            </div>
        </div>
    </div>
</block>
<block name="javascript">
    <script>

        $("#sub").click(function () {
            $.ajax({
                url: '<?php echo U("ReturnAddress/index"); ?>',
                type: 'post',
                data: {
                    address_id: $("input[name='address_id']").val(),
                    name: $("input[name='name']").val(),
                    telephone: $("input[name='telephone']").val(),
                    address: $("input[name='address']").val(),
                },
                success: function (data) {
                    if (data.code == 200) {
                        alert('提交成功');
                        window.location.reload();
                    } else {
                        alert('提交失败');
                    }
                },
                error: function () {
                    //请求出错处理
                    alert('请求出错');
                }
            });
        });

    </script>
</block>